package com.sbio.udiapp.util;

import android.app.Activity;
import android.view.Gravity;
import android.widget.Toast;

import com.blankj.utilcode.util.ToastUtils;
import com.sbio.udiapp.R;
import com.sbio.udiapp.di.ActivityManager;

public class ToastUtil {

    public static void showLong(String content) {
        Activity context = ActivityManager.getCurrentActivity();
        Toast.makeText(context, content, Toast.LENGTH_LONG).show();
    }

    public static ToastUtils getDefaultToastUtils() {
        return ToastUtils.make()
                .setLeftIcon(R.mipmap.ic_launcher)
                .setGravity(Gravity.TOP, 0, 96)
                .setDurationIsLong(true);
    }

    public static void show(String content) {
        getDefaultToastUtils().show(content);
    }

    public static void show(int resId) {
        getDefaultToastUtils().show(resId);
    }

    public static void showSuccess(String content) {
        SoundPlayerUtil.playSuccess();
        show(content);
    }

    public static void showError(String content) {
        VibratorUtil.vibrator();
        SoundPlayerUtil.playFail();
        show(content);
    }

    public static void showWait(String content) {
        VibratorUtil.vibrator();
        SoundPlayerUtil.playWait();
        show(content);
    }
}
